import { getColors } from './config/option'

/**
 * 首屏 - 各街道实时在线人员
 */

export function pie1(renderData, config) {
  renderData = renderData[0].data
  let roseType = false
  if (config.roseType) {
    roseType = true
  }
  let radius = ['0%', '70%']
  if (config.ringType) {
    radius = ['50%', '70%']
  }
  return {
    color: getColors(),
    tooltip: {
      trigger: 'item',
      formatter: (params) => {
        return `${params.marker}${params.name}: ${params.value}人 <br>占比:${params.percent}%`
      }
    },
    series: [
      {
        name: '',
        type: 'pie',
        radius: radius,
        center: ['50%', '50%'],
        roseType: roseType,
        borderWidth: 0,
        textBorderWidth: 0,
        label: {
          show: false,
          position: 'outer',
          formatter: '{b}: {c}人\n\n{d}%'
        },

        emphasis: {
          label: {
            show: true,
            color: '#fff'
          },
          labelLine: {
            show: true,
            lineStyle: {
              color: '#fff'
            }
          }
        },
        data: renderData
      }
    ]
  }
}
